import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询文章列表
export function listArticle(query) {
  return request({
    url: '/Article/selectArticle',
    method: 'get',
    params: query
  })
}

// 查询文章列表
export function listArticleById(query) {
  return request({
    url: '/Article/selectArticleById',
    method: 'get',
    params: query
  })
}

// 新增文章
export function addArticle(data) {
  return request({
    url: '/Article/addArticle',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
   }
  })
}

// 修改文章
export function updateArticle(data) {
  return request({
    url: '/Article/updateArticle',
    method: 'put',
    data: data,
    headers: {
         'Content-Type': 'multipart/form-data'
    }
  })
}

// 文章删除
export function deleteArticle(articleIds) {
  return request({
    url: '/Article/deleteArticle/'+articleIds,
    method: 'delete'
  })
}

// 文章状态修改
export function changeArticleStatus(id, articleStatus) {
  const data = {
    id,
    articleStatus
  }
  return request({
    url: '/Article/changeArticleStatus',
    method: 'put',
    data: data
  })
}
